<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-projectSuite-edit" th:object="${projectSuite}">
            <input id="suiteId" name="suiteId" th:field="*{suiteId}"  type="hidden">
            <input id="projectId" name="projectId" th:field="*{projectId}"  type="hidden">
            <input id="suitePlanCount" name="suitePlanCount" th:field="*{suitePlanCount}"  type="hidden">
            <div class="form-group">	
				<label class="col-sm-3 control-label">项目名称：</label>
				<div class="col-sm-8">
				    <strong class="form-control" th:text="*{project.projectName}"></strong>
				</div>
		    </div>			
			<div class="form-group">	
				<label class="col-sm-3 control-label">聚合计划名称：</label>
				<div class="col-sm-8">
					<input id="suiteName" name="suiteName" th:field="*{suiteName}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea id="remark" name="remark" th:field="*{remark}" class="form-control" rows="8"></textarea>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "testmanagmt/projectSuite";

		$("#form-projectSuite-add").validate({
			rules:{
				suiteName:{
					required:true,
        			maxlength: 50,
                    remote: {
                        url: prefix + "/checkProjectSuiteNameUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                            name: function () {
                                return $.common.trim($("#suiteName").val());
                            }
                        },
                        dataFilter: function (data, type) {
                        	return $.validate.unique(data);
                        }
                    }
				},
				remark:{
					maxlength:200
				}
			},
        	messages: {
                "suiteName": {
                    remote: "聚合计划名称已经存在"
                }
            }
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-projectSuite-edit').serialize());
	        }
	    }
	</script>
</body>
</html>
